Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for long file paths in CheckoutOptions #2120

Closed
wants to merge 1 commit into from

Conversation

DenisKudelin
Copy link

Summary

Adds support for long file paths in CheckoutOptions by introducing the LongPaths property and updating CheckoutStrategy with the GIT_CHECKOUT_LONGPATHS flag.

Changes

  • New property LongPaths in CheckoutOptions.
  • Added GIT_CHECKOUT_LONGPATHS to CheckoutStrategy.

Motivation

Enhances compatibility with projects that have deeply nested directories or long file names, especially on Windows.

@DrewScoggins
Copy link

@bording could you take a look at this PR and help get it merged?

@Ogglas
Copy link

Ogglas commented Oct 6, 2024

@bording We really need this bug fixed. Please prioritize it if possible

@LoopedBard3
Copy link

@Ogglas, I was able to workaround this by setting the longpath option in the global git config. Presuming a global git config already being present on the machine at %USERPROFILE%.gitconfig, we create a temp repo (new Repository(Repository.Init("temprepo"))) and then set the longpath setting in that global config with temp_repo.Config.Set("core.longpaths", true, ConfigurationLevel.Global);. With that set, the clone should use the global setting as long as it is not set at a more local level.

@bording
Copy link
Member

bording commented Nov 24, 2024

As far as I can tell, this PR isn't actually doing anything. The support for long paths on Windows that was added to libgit2 in libgit2/libgit2#5857 only supports the core.longpaths configuration setting.

Furthermore, the GIT_CHECKOUT_LONGPATHS setting that's been added to the CheckoutStrategy enum doesn't seem to exist at all in libgit2.

(1 << 24) is an entirely different option, GIT_CHECKOUT_DRY_RUN.

The good news is that LibGit2Sharp has been respecting the core.longpaths setting since at least 0.27.0, so you can already use long paths without needing any other changes.

@bording bording closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants